<?php

namespace app\admin\controller\member;

use app\admin\model\UM as UM;
use app\admin\service\LawyerDraftService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use ShidianUtil\Utils\CheckUtil;
use think\APP;
use think\Request as Request;

/**
 * LegalDraft 控制器
 * Class LegalDraft
 * @package app\member\controller
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 */
class LegalDraft
{
    private Request $request;

    private LawyerDraftService $service;

    public function __construct(Request $request, LawyerDraftService $lawyerDraftService)
    {
        $this->request = $request;
        $this->service = $lawyerDraftService;
    }

    /**
     * 法务申请-列表
     * @param \app\admin\model\UM|null $user
     * @return ApiResponse
     * @url /member/legal_draft/index
     */
    public function index(?UM $user): ApiResponse
    {
        $request = $this->request;

        $checkStatus = $request->param('checkStatus', null);
        $provinceId = $request->param('provinceId', null);
        $cityId = $request->param('cityId', null);
        $startTime = $request->param('startTime', null);
        $endTime = $request->param('endTime', null);
        $kw = $request->param('kw', null);

        $page = $request->param('page', 1);
        $page_size = $request->param('page_size', 20);

        return ApiResponse::success($this->service->index($user, $checkStatus, $provinceId, $cityId, $startTime, $endTime, $kw, 1, $page, $page_size));
    }

}
